#ifndef ABSTRACTENVIRONMENT_H
#define ABSTRACTENVIRONMENT_H

#include "AbstractSituatedObject.hpp"
#include "Bodies/AgentBody.hpp"
#include "Perceptions/Perception.hpp"
#include <vector>

//Donne à l'agent son body

class AbstractEnvironment{
protected:
    double m_width, m_height;
    std::vector<AbstractSituatedObject*> m_objects;
    std::vector<AgentBody*>  m_bodies;
    void move(AbstractMobileObject*,Vector2D*,double);

public:
    inline void addAgentBody(AgentBody* ab){
        m_bodies.push_back(ab);
    }

    inline void addObstacle(AbstractSituatedObject* obstacle){
        m_objects.push_back(obstacle);
    }

    inline  std::vector<AbstractSituatedObject*> getSituatedObjects(){
        return m_objects;
    };

    inline  std::vector<AgentBody*> getAgentBodies(){
        return m_bodies;
    };

    void runBehaviour() {
        std::vector<Perception*> perceptions;
        for (int i = 0; i < m_bodies.size(); i++) {
            perceptions = computePerceptionsFor(*(m_bodies[i]));
            (m_bodies[i])->setObjectsPerceived(perceptions);
        }
    }

    virtual std::vector<Perception*> computePerceptionsFor(AgentBody&)=0;

};

#endif // ABSTRACTENVIRONMENT_H
